<template>
  <el-dropdown @command="changeLang">
    <span class="el-dropdown-link">
      <svg-icon icon-class="language" />
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item :disabled="$i18n.locale === 'en'" command="en">English</el-dropdown-item>
      <el-dropdown-item :disabled="$i18n.locale === 'zh'" command="zh">中文</el-dropdown-item>
      <el-dropdown-item :disabled="$i18n.locale === 'ja'" command="ja">日本語</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
import Cookies from 'js-cookie'
export default {

  methods: {

    changeLang (cmd) {

      this.$i18n.locale = cmd
      // 存起来
      Cookies.set('lang', cmd)
      this.$router.go(0)
    }
  }
};
</script>

<style>
</style>